#include<iostream>
using namespace std;
int main(){
	int n=0,i=0,count=0;
	cin>>n;
	int arr[n];
	for(i=0;i<n;i++){
		cin>>arr[i];
	}
	int min=arr[0],max=arr[0];
	for(i=0;i<n;i++){
		if(arr[i]>max){
			max=arr[i];
		}
		if(arr[i]<min){
			min=arr[i];
		}
		count+=arr[i];
	}
	double answer=(count-max-min)/(1.0*(n-2));
	printf("%.2f",answer);
	return 0;
}
